﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace GameProject
{
    /// <summary>
    /// Player class, creates a new player
    /// and keeps track of inputs.
    /// </summary>
    class Player
    {
        private Texture2D playerSprite;
        private Vector2 spritePosition;
        private int points;
        private float movementSpeed;
        private SpriteFont Font, Font2;
        private string positionString, pointsString;

        public Player() { }
        public void Initialize()
        {
            movementSpeed = 150;
            points = 0;
            spritePosition = new Vector2(500-13, 750-13);
        }
        public void LoadContent(ContentManager Content)
        {
            playerSprite = Content.Load<Texture2D>("playerSprite");
            Font = Content.Load<SpriteFont>("SpriteFont1");
            Font2 = Content.Load<SpriteFont>("SpriteFont2");
            pointsString = points.ToString();
        }
        public void Update(GameTime gametime)
        {
            positionString = spritePosition.ToString();
            pointsString = points.ToString();
        }
        public void Draw(SpriteBatch spritebatch)
        {
            spritebatch.Draw(playerSprite, spritePosition, Color.White);
            spritebatch.DrawString(Font, "Score: " + points.ToString(), new Vector2(getPlayerX(), getPlayerY() + 45), Color.Black);
        }
        public Vector2 getPlayerMiddle()
        {
            float x, y;
            x = getPlayerX()+7;
            y = getPlayerY()+7;
            Vector2 temp = new Vector2(x, y);
            return temp;
        }
        public void setPlayerX(float x) { this.spritePosition.X = x; }
        public void setPlayerY(float y) { this.spritePosition.Y = y; }
        public float getPlayerX() { return spritePosition.X; }
        public float getPlayerY() { return spritePosition.Y; }
        public void reload()
        {
            points -= 30;
        }

        public void setMovementSpeed(int speed) { movementSpeed = speed; }
        public float getMovementSpeed() { return this.movementSpeed; }
        public void addToMovementSpeed(int speed) { movementSpeed += speed; }

        public void addPoints()
        {
            points += 5;
        }
        public int getPoints()
        {
            return points;
        }
        
        
        

    }
}
